<?php
class Auth extends Controller
{
    function Auth()
    {
        parent::Controller();
        $this->load->library('session');

    }
    
    function index()
    {
        echo "welcome !";
    }

    /**
     * login
     *
    */
    function login()
    {
        $user_id = $this->session->userdata("user_id");
        
        if(intval($user_id) > 0)
        {
            $this->index();
        }
        else
        {
            if($this->input->post("submit"))
            {
                $username = $this->input->post("username");
                $password = $this->input->post("password");
                echo "username : ".$username ."<br />";
                echo "password : ".$password ."<br />";
            }
            else
            {
                $this->load->view("header");
            }
        }
    }
    
}
?>